package com.smt.common.base;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.springframework.web.bind.annotation.InitBinder;

import java.text.SimpleDateFormat;
import java.util.Date;

public abstract class BaseController {
        private static final Logger log = LoggerFactory.getLogger(BaseController.class);

        public BaseController() {
        }

        @InitBinder
        public void initBinder(ServletRequestDataBinder binder) {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
            CustomDateEditor cust = new CustomDateEditor(sdf, true);
            binder.registerCustomEditor(Date.class, cust);
        }
}

